cmake_minimum_required(VERSION 2.8.3)
project(smarteye_common)

set(CMAKE_BUILD_TYPE "Release")
if( CMAKE_BUILD_TYPE STREQUAL "Debug" )
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g -Wall -Wno-unused-variable -pthread")
else( CMAKE_BUILD_TYPE STREQUAL "Debug" )
    set(CMAKE_BUILD_TYPE "Release")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O3 -pthread -fopenmp")
endif( CMAKE_BUILD_TYPE STREQUAL "Debug" )

find_package(catkin REQUIRED COMPONENTS
  message_filters
  message_generation
  roscpp
  rospy
  std_msgs
  std_srvs
  geometry_msgs
  mavros_msgs
)






add_message_files(DIRECTORY msgs/control
FILES
controlMsg.msg
behaviorMsg.msg
planMsg.msg
strategyMsg.msg
)




add_message_files(DIRECTORY msgs/communication
FILES
flightStateMsg.msg
AllGVehiclesPos.msg
AllVehiclesPos.msg
ParamCoord.msg
RefPos.msg
CommandLong.msg
)

add_message_files(DIRECTORY msgs/formation
FILES
DesiredAttitude.msg
WingmanFormationInfo.msg
)

add_message_files(DIRECTORY msgs/commander
FILES
CommandAck.msg
CommandAckCustom.msg
)


add_service_files(DIRECTORY srvs/commander
  FILES
  HParamSetSrv.srv
  ReqAllVehicleState.srv
  UInt16Srv.srv
)

add_service_files(DIRECTORY srvs/communication
  FILES
  ReqPullRoute.srv
  ReqPushRoute.srv
)

add_service_files(DIRECTORY srvs/route_manager
  FILES
  ReqFmRoute.srv
)

generate_messages(DEPENDENCIES std_msgs geometry_msgs mavros_msgs )

set(smarteye_common_includes
               ${catkin_INCLUDE_DIRS}
               ${PROJECT_SOURCE_DIR}/core/include 
)
include_directories(${smarteye_common_includes})
catkin_package(
  INCLUDE_DIRS ${smarteye_common_includes}
  INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/core/include
  LIBRARIES smarteye_common
  CATKIN_DEPENDS   message_filters  message_generation  roscpp  rospy  std_msgs  std_srvs  geometry_msgs mavros_msgs
)
add_library(smarteye_common  STATIC
                             core/src/MathCal.cpp

)
add_dependencies(smarteye_common  ${catkin_EXPORTED_TARGETS})
target_link_libraries(smarteye_common
    ${catkin_LIBRARIES}
)


#########install

install(TARGETS smarteye_common
  ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

install(DIRECTORY launch/
  DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
)

install(DIRECTORY core/include/smarteye/core/
  DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}/smarteye/core/
  FILES_MATCHING PATTERN "*.h*"
)
